﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.Entities.BPM_Business;
using NP.BPMReportPlatform.HR.Dto;
using NP.BPMReportPlatform.TaxManage.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.ObjectMapping;

namespace NP.BPMReportPlatform.TaxManage
{
    /// <summary>
    /// 税务平台的开票内容查询
    /// </summary>
    // [Authorize]
    [ApiController]
    [Route("api/TaxManage/")]
    public class NotesRedLetterController : BPMReportPlatformController
    {
        private INotesRedLetterService _notesRedLetterService;
        public NotesRedLetterController(INotesRedLetterService notesRedLetterService)
        {

            _notesRedLetterService = notesRedLetterService;
        }
         

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("NotesRedLetter/QueryAsync")]
        public async Task<PagedResultDto<NotesRedLetterDto>> GetAllAsync([FromBody] NotesRedLetterSearchDto input)
        {

            return await _notesRedLetterService.GetAllAsync(input);
        }

        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("NotesRedLetter/ExportAsync")]
        public async Task<XlsxFileResult<NotesRedLetterDto>> ExportAsync([FromBody] NotesRedLetterSearchDto input)
        {
            var rst = await _notesRedLetterService.ExportAsync(input);
            return new XlsxFileResult<NotesRedLetterDto>(rst, "导出Excel"); 
        }

    }
}
